package com.googlecode.yonggemovie.ui;

import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 总体风格设置
 * @author Kobe Su,2009-12-8
 */
public class LookAndFeelSetting {

	public static final Log log = LogFactory.getLog(LookAndFeelSetting.class);
	
	private LookAndFeelSetting(){}
	
	public static void init() {
		JFrame.setDefaultLookAndFeelDecorated(true);
		
		try {
//			if (isSupportedNimbus()) 
//				return;
			
			//substance laf

			UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceRavenLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceRavenGraphiteGlassLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceEmeraldDuskLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.api.skin.SubstanceGraphiteAquaLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceNebulaBrickWallLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceMistSilverLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookAndFeel");
			
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceTwilightLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel");
			//UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceChallengerDeepLookAndFeel");
			
			//jgoodies laf
//			Plastic3DLookAndFeel.setPlasticTheme(new BrownSugar());
//			UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel"); //$NON-NLS-1$
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}
	}

	/**
	 * 是否支持Nimbus look and feel（只有jdk6 update10以上才支持）
	 */
	public static boolean isSupportedNimbus() {
		boolean isNimbus = false;
		try {
			for (LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
				if ("Nimbus".equals(laf.getName())) {
					isNimbus = true;
					UIManager.setLookAndFeel(laf.getClassName());
					break;
				}
			}		
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return isNimbus;
	}
	
	public static void main(String[] args) {

	}

}
